package csu.rjxyg.bean;

import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;

import csu.rjxyg.bean.core.BaseBean;
import csu.rjxyg.bean.core.BaseList;
import csu.rjxyg.bean.core.BaseObject;

public class DBList extends BaseList{
	private BasicDBList bean;
	
	
	public DBList(){
		bean = new BasicDBList();
	}
	
	@Override
	public BaseObject get(int index) {
		BaseObject temp = new DBObject( (BasicDBObject) bean.get(index));
		return temp;
	}

	@Override
	public int size() {
		return bean.size();
	}

	@Override
	public void add(BaseBean baseBean) {
		// TODO Auto-generated method stub
		bean.add(baseBean.getBean());
	}

	@Override
	public void add(int index, BaseBean baseBean) {
		// TODO Auto-generated method stub
		bean.add(index, baseBean.getBean());
	}
	
	@Override
	public void remove(int index){
		bean.remove(index);
	}

	@Override
	public BasicDBList getBean() {
		// TODO Auto-generated method stub
		return bean;
	}
	

	@Override
	public void setBean(Object bean) {
		// TODO Auto-generated method stub
		this.bean = (BasicDBList) bean;
	}

}
